/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.jasoet.test;

import java.util.List;
import org.hibernate.HibernateException;
import org.jasoet.controller.PenerbitController;
import org.jasoet.model.Penerbit;

/**
 *
 * @author Deny Prasetyo
 */
public class MainClass {

    public static void main(String[] args) {
        PenerbitController pc = new PenerbitController();
        try {
            Penerbit pn = new Penerbit("P002", "PT. Sampoerna Java");
            pc.insert(pn);
        } catch (HibernateException ex) {
            System.out.println(ex.getMessage());
        }

        try {
            Penerbit pn = new Penerbit("P003", "PT. Java Terbitindo");
            pc.insert(pn);
        } catch (HibernateException ex) {
            System.out.println(ex.getMessage());
        }
        List<Penerbit> listP = pc.loadAll();
        for (Penerbit p : listP) {
            System.out.println(p.getKode());
            System.out.println(p.getNama());
        }
    }
}
